Ext.define("Triends.controller.TinglistController",{
	extend: "Ext.app.Controller",
	xtype: "tinglistcontroller",
	config: {
		refs: {
			tinglist: "tinglist",
			listBtn: "#listBtn",
			mapBtn: "#mapBtn",
			list: "#list",
			map: "#map"
		},
		control: {
			listBtn: {
				tap: "onListBtn"
			},
			mapBtn: {
				tap: "onMapBtn"
			},
			list: {
				itemtap: "onListTap"
			}
		}
	},
	onListBtn: function(){
		var tinglist = this.getTinglist();
		var list = this.getList();
		var map = this.getMap();
		tinglist.remove(map, false);
		tinglist.add(list);
	},
	onMapBtn: function(){
		var tinglist = this.getTinglist();
		var map = this.getMap();
		var list = this.getList();
		tinglist.remove(list, false);
		tinglist.add(map);
	},
	onListTap: function(){
		var searchcmp = Ext.getCmp('search');
           	searchcmp.setActiveItem(1);
	}
})
